<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
$intLType = (int)$data["LType_n"];
if($intLType == 0)$intLType = 1;

//找出 Lotto 的單場、單注限額，傳回陣列
if(!$arrELimits = FindLottoLimits(-1))include($_SERVER["DOCUMENT_ROOT"]."/error.php");
//找出 Lotto 的下注參數，傳回陣列
if(!$arrBP = GetArrayBetParam(-1, $intLType))include($_SERVER["DOCUMENT_ROOT"]."/error.php");

?><html>
<head>
<title> <?php print $_strLotto["Title"];?> (Add) </title>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<link rel="stylesheet" href="/css/backend.css" type="text/css">
<script Language="JavaScript1.2" type="text/javascript" src="/inc/checkdata_<?php print $_intLang;?>.js"></script>
<script Language="JavaScript1.2" type="text/javascript" src="/inc/betlimit_<?php print $_intLang;?>.js"></script>
<script Language="JavaScript1.2" type="text/javascript" src="/inc/GambleTypeMenu.js"></script>
</script>
<script Language="JavaScript">
<!--
function finalcheck(){
	with(document.beMemberFrm){
		if(Check(document.beMemberFrm))submit();
	}
}
//-->
</SCRIPT>
</head>

<body class="Mybody">

<!-- 檢驗資料用 //-->
<form name="CheckDataForm">
	<?php print CheckGambleLimits($_strLotto["EventLimit"], $_strLotto["BetLimit"], $intLType);?>
</form>
<!-- End //-->

<div id="GambleTypeLayer" style="z-index: 3; filter: shadow(color=#333333,direction=135); display: none; position:absolute;">
<table bgcolor="#3366CC" style="filter:Alpha(opacity=80); " cellspacing="0" border="0" cellpadding="0">
<tr><td id="GambleTypeTD" style="cursor: hand"></td></tr></table></div>

<form name="beMemberFrm" method="Post" action="index.php">
<input type="hidden" name="op" value="Insert">
<table class="Mytable" cellspacing="1" cellpadding="0">
	<tr>
		<td class="MyUp" colspan="2">
			<table width="100%" cellspacing="0" cellpadding="0" border="0">
				<tr>
					<td align="left" class="MyUp_Title"><?php print $_strLotto["Title"];?> (Add)</td>
					<td align="right" class="MyUp_Title"><?php include("MenuPage.php");?></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td class="MyTitle"><?php print $_strLotto["LType"];?></td>
		<td class="MyCell">
			<select name="data[LType_n]" onchange="document.beMemberFrm.op.value='Add';document.beMemberFrm.submit();">
				<?php
					foreach($_arrLType as $intLTypeID => $strLType){
						print "<option value='".$intLTypeID."'".($intLType == $intLTypeID?" selected":"").">".$strLType."</option>\n";
					}
				?>
			</select>
		</td>
	</tr>
	<?php if($_intLang == 3){ ?>
	<tr>
		<td class="MyTitle"><?php print $_strLotto["Lotto_3"];?></td>
		<td class="MyCell"><input type="text" name="data[Lotto_3_x]" class="input_text">
		</td>
	</tr>
	<?php }else{ ?>
	<tr>
		<td class="MyTitle"><?php print $_strLotto["Lotto_1"];?></td>
		<td class="MyCell"><input type="text" name="data[Lotto_1_x]" class="input_text">
		</td>
	</tr>
	<?php } ?>
	<tr>
		<td class="MyTitle"><?php print $_strLotto["Lotto_2"];?></td>
		<td class="MyCell"><input type="text" name="data[Lotto_2_x]" class="input_text">
		</td>
	</tr>
	<tr>
		<td class="MyTitle"><?php print $_strLotto["LottoURL"];?></td>
		<td class="MyCell"><input type="text" name="data[LottoURL_x]" class="input_text">
		</td>
	</tr>
	<tr>
		<td class="MyTitle"><?php print $_strLotto["Number"];?></td>
		<td class="MyCell"><input type="text" name="data[Number_x]" class="input_text"> (ex: 01-42)
		</td>
	</tr>
	<tr>
		<td class="MyTitle"><?php print $_strLotto["ColorSet"];?></td>
		<td class="MyCell"><input type="text" name="data[ColorSet_x]" class="input_text" size="80"> (ex: 01-42)
		</td>
	</tr>
	<tr>
		<td class="MyTitle"><?php print $_strLotto["DrawSpecial"];?></td>
		<td class="MyCell"><input type="text" name="data[DrawSpecial_n]" class="input_text" size="4">
		</td>
	</tr>
	<tr>
		<td class="MyTitle"><?php print $_strLotto["SpecialOverNumber"];?></td>
		<td class="MyCell"><input type="text" name="data[SpecialOverNumber_n]" class="input_text" size="4">
		</td>
	</tr>
	<tr>
		<td class="MyTitle"><?php print $_strLotto["NormalOverNumber"];?></td>
		<td class="MyCell"><input type="text" name="data[NormalOverNumber_n]" class="input_text" size="4">
		</td>
	</tr>
	<tr>
		<td class="MyTitle"><?php print $_strLotto["LottoOdds"];?></td>
		<td class="MyCell">
			<br>
			<table cellspacing="0" cellpadding="0" border="0">
			<tr>
				<td valign="top">
					<table cellspacing="0" cellpadding="0" border="0">
					<tr>
						<td class="MyCell" align="right" style="font-weight: 700"><?php print $_strLotto["_Comm"];?></td>
						<td class="MyCell" align="center"><?php print $_strLotto["Odds"];?></td>
					</tr>
					<tr>
						<td colspan="2" height="5" style="border-top: 1 solid #336600; font-size: 5pt;">&nbsp;</td>
					</tr>
					<?php
						$strSQL =  "select ID as BID, Type_Value_".$_intLang." as Type_Value from `bet_BetType` where isGambleType = 1 and LType = ".$intLType." order by ID";
						if($RS = @PMA_mysql_query($strSQL, $$_Conn)){
							if(PMA_mysql_num_rows($RS) > 0){
								while($Rows = PMA_mysql_fetch_object($RS)){
								?>
					<tr>
						<td class="MyCell" style="height:30px; width:120px" align="right"><?php print $Rows -> Type_Value;?>&nbsp;</td>
						<td align="left"><?php print MakeGambleTypeSelect("OddsValue", $intLType, $Rows -> BID, "");?></td>
					</tr>
								<?php
								}
								@mysql_free_result($RS);
							}
						}
					?>
					</table>
				</td>
			</tr>
			</table>

		</td>
	</tr>
	<tr>
		<td class="MyTitle"><?php print $_strLotto["EventLimit"];?></td>
		<td class="MyCell">
			<?php print TableLottoLimits($arrELimits,0, $arrLimitBT[$intLType][0], $arrLimitBT[$intLType][1], $intLType);?>
		</td>
	</tr>
	<tr>
		<td class="MyTitle"><?php print $_strLotto["BetLimit"];?></td>
		<td class="MyCell">
			<?php print TableLottoLimits($arrELimits,1, $arrLimitBT[$intLType][0], $arrLimitBT[$intLType][1], $intLType);?>
		</td>
	</tr>
	<tr>
		<td class="MyTitle"><?php print $_strLotto["LottoBetParam"];?></td>
		<td class="MyCell">
			<br>
			<table cellspacing="0" cellpadding="0" border="0">
			<tr>
				<td valign="top">
					<table cellspacing="0" cellpadding="0" border="0">
					<tr>
						<td align="right">&nbsp;</td>
						<?php while(list($k) = each($arrBP[1])){ ?>
						<td class="MyCell" align="center"><?php print $_strLotto[$k];?></td>
						<?php } 
						reset($arrBP[1]);
						$intColspan = 1+ sizeof($arrBP[1]);
						?>
					</tr>
					<tr>
						<td colspan="<?php print $intColspan;?>" height="5" style="border-top: 1 solid #336600; font-size: 5pt;">&nbsp;</td>
					</tr>
					<?php
						$strSQL =  "select ID as BID, Type_Value_".$_intLang." as Type_Value from `bet_BetType` where LType = ".$intLType." order by ID";
						if($RS = @PMA_mysql_query($strSQL, $$_Conn)){
							if(PMA_mysql_num_rows($RS) > 0){
								while($Rows = PMA_mysql_fetch_object($RS)){
								?>
					<tr>
						<td class="MyCell" style="height:30px; width:120px" align="right"><?php print $Rows -> Type_Value;?>&nbsp;</td>
									<?php while(list($k, $v) = each($arrBP[$Rows -> BID])){ ?><td align="left"><input type="text" size="7" name="arrBetParam[<?php print $Rows -> BID;?>][<?php print $k;?>]" value="<?php print $v;?>"  class="input_text">&nbsp;</td><?php } ?>
					</tr>
								<?php
								}
								@mysql_free_result($RS);
							}
						}
					?>
					</table>
				</td>
			</tr>
			</table>

		</td>
	</tr>
	<tr>
		<td class="MyButton" colspan="2" align="center">
			<input type="button" value="<?php print $_strLotto["_Add"];?>" onclick="finalcheck()" class="submit"><!--新增//-->&nbsp;
			<input type="reset" value="<?php print $_strLotto["_Reset"];?>" class="submit"><!--清除//-->
		</td>
	</tr>
</table>
</form>

</body>
</html>